package xin.marcher.module.common.enums.quality;

import java.util.HashMap;
import java.util.Map;

/**
 * 调查任务状态
 */
public enum SurveyStatusEnum {

    /**
     * 待处理状态
     */
    UN_HANDLED_STATUS(1, "待处理"),
    /**
     * 调查单已发送
     */
    SURVEY_FORM_SEND_STATUS(2, "调查单已发送");

    private Integer code;

    private String value;

    SurveyStatusEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public String getValue() {
        return value;
    }

    public static Map<Integer, String> toMap() {
        Map<Integer, String> map = new HashMap<>(16);
        for (SurveyStatusEnum element : SurveyStatusEnum.values()) {
            map.put(element.getCode(), element.getValue());
        }
        return map;
    }

    public static SurveyStatusEnum getByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (SurveyStatusEnum element : SurveyStatusEnum.values()) {
            if (code.equals(element.getCode())) {
                return element;
            }
        }
        return null;
    }
}
